Class TreeCollection<TProps>
Typed version of collection for backward compatibility
Wrapper over polymorphic TreeCollection with type safety
public class TreeCollection<TProps> : IEnumerable<ITreeRedbObject<TProps>>, IEnumerable where TProps : class, new()
Inheritance
Implements
Properties
Leaves
Gets all leaf nodes (without children)
public IEnumerable<ITreeRedbObject<TProps>> Leaves { get; }
Orphans
Gets orphan nodes (whose parents haven't been added to collection)
public IEnumerable<ITreeRedbObject<TProps>> Orphans { get; }
Roots
Gets all root nodes (without parents)
public IEnumerable<ITreeRedbObject<TProps>> Roots { get; }
Methods
Add(ITreeRedbObject<TProps>)
Adds typed node to collection
public void Add(ITreeRedbObject<TProps> node)
AddRange(IEnumerable<ITreeRedbObject<TProps>>)
Adds range of typed nodes
public void AddRange(IEnumerable<ITreeRedbObject<TProps>> nodes)
FindNodes(Func<ITreeRedbObject<TProps>, bool>)
Finds typed nodes by predicate
public IEnumerable<ITreeRedbObject<TProps>> FindNodes(Func<ITreeRedbObject<TProps>, bool> predicate)
GetEnumerator()
Returns an enumerator that iterates through the collection.
public IEnumerator<ITreeRedbObject<TProps>> GetEnumerator()
GetFlattenedWithLevels()
Gets flattened list of all typed nodes with level indication
public IEnumerable<(ITreeRedbObject<TProps> Node, int Level)> GetFlattenedWithLevels()